package com.qf.shopgoods.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.qf.entity.Goods;
import com.qf.resp.ResultEntity;
import com.qf.shopgoods.service.IGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/goodsController")
public class GoodsController {

    @Autowired
    private IGoodService goodService;

    @RequestMapping("/getGoodsPage")
    public Page<Goods> getGoodsPage(@RequestBody Page<Goods>page){
        return goodService.selectPage(page);
    }


    @RequestMapping("/addGoods")
    public ResultEntity addGoods(@RequestBody Goods goods){
        return ResultEntity.success(goodService.insert(goods));
    }
}
